package com.ghxxzx.daglcustom.business_form.service;

import com.ghxxzx.daglcustom.business_form.domain.FormTypePo;
import com.ghxxzx.daglcustom.business_form.domain.dto.FormTypeQuery;
import org.springframework.stereotype.Service;
import org.tmsps.ne4spring.base.BaseService;
import org.tmsps.ne4spring.base.ne.NePage;
import org.tmsps.ne4spring.orm.param.NeParamList;

import java.util.List;
import java.util.Map;

@Service
public class FormTypeService extends BaseService {

	public NePage list(FormTypeQuery formTypeQuery) {
		String sql = "SELECT * FROM t_form_type where type like ? and status = 0";
		NeParamList params = NeParamList.makeParams();
		params.addLike(formTypeQuery.getType());
		NePage page2 = bs.queryForNePage(sql, params, formTypeQuery.getSort(), formTypeQuery.getPage());
		return page2;
	}

	public FormTypePo findFormTypeByType(String type) {
		String sql = "SELECT * FROM t_form_type t where t.status=0 and t.type=? ";
		FormTypePo formTypePo = bs.findObj(FormTypePo.class, sql, type);
		return formTypePo;
	}
	
	/**
	 * 查询全部的表单类型的数据
	 * @return
	 */
	public List<Map<String,Object>> listAll() {
		String sql = "SELECT * FROM t_form_type where status = 0";
		return jt.queryForList(sql);
	}

}
